package com.xhwl.centiotdata.pushtrigger.eesd;

import com.alibaba.fastjson.JSONObject;
import com.xhwl.centiotdata.handler.eesd.impl.EesdQiMingHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description:
 * @Copyright: Copyright (c) 2021  ALL RIGHTS RESERVED.
 * @Company: 深圳市兴海物联科技有限公司
 * @Author: gyc
 * @CreateDate: 2021/12/9 16:45
 * @UpdateDate: 2021/12/9 16:45
 * @UpdateRemark: init
 * @Version: 1.0
 */
@Slf4j
@RestController
public class EesdController {

    @Resource
    private EesdQiMingHandler eesdQiMingHandler;

    /**
     * 充电桩鉴权回调接口
     */
    @PostMapping(value = "/2/query_token")
    public JSONObject queryToken2(@RequestBody JSONObject dto) {
        log.info("充电桩鉴权回调接口开始:{}", JSONObject.toJSONString(dto));
        return eesdQiMingHandler.queryToken(dto);
    }

    /**
     *推送充电订单信息
     */
    @PostMapping(value = "/2/notification_charge_order_info")
    public JSONObject callChargeOrder2(@RequestBody JSONObject dto) {
        log.info("推送充电订单信息接口开始:{}", JSONObject.toJSONString(dto));
        return eesdQiMingHandler.callChargeOrder(dto);
    }

    /**
     * 枪状态推送
     * @param dto
     * @return
     */
    @PostMapping(value = "/2/notification_stationStatus")
    public JSONObject callStationStatusV1(@RequestBody JSONObject dto) {
        log.info("设备状态变化推送:{}", JSONObject.toJSONString(dto));
        return eesdQiMingHandler.callStationStatus(dto);
    }

}
